<template>
    <div>
        <h1>会员列表展示</h1>
        会员名：<input type="text" v-model="find.name">
        性别：
        <input type="text" v-model="find.sex">
        <input type="button" value="查询" @click="Show">
       
         <table class="table">
            <thead>
                <tr>
                <td>会员名</td>
                <td>生日</td>
                <td>性别</td>
                <td>年龄</td>
                <td>手机号</td>
                <td>地址</td>
                </tr>
            </thead>
           <tbody>
            <tr v-for="a in data">
                <td>{{a.name  }}</td>
                <td>{{moment(a.birthday).format("YY-MM-DD")  }}</td>
                <td>{{a.sex?"男":"女"  }}</td>
                <td>{{a.age  }}</td>
                <td>{{a.phone  }}</td>
                <td>{{a.addr  }}</td>
            </tr>
           </tbody>
         </table>
    </div>
</template>

<script setup lang="ts">
import {ref,onMounted} from "vue"
import axios from "axios";
import moment from "moment";
const data=ref([{
    "id": 0,
  "name": "",
  "birthday": "2025-04-22T01:55:26.483Z",
  "sex": 0,
  "age": 0,
  "phone": "",
  "addr": ""
}])
const find=ref({
    name:"",
    sex:0
})
onMounted(()=>{
    Show();
})
const Show=()=>{
    axios.get("https://localhost:7278/api/Member/GetMembers",{params:find.value}).then(res=>{
        data.value=res.data
    })
}
</script>

<style scoped>

</style>